//
//  YijiaCellTwo.m
//  HomeIn
//
//  Created by dllo on 15/11/9.
//  Copyright © 2015年 ZZP. All rights reserved.
//

#import "YijiaCellTwo.h"
#import "YijiaModel.h"

@implementation YijiaCellTwo

-(instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier
{
    self=[super initWithStyle:style reuseIdentifier:reuseIdentifier];
    if (self) {
        [self createSubViews];
    }
    return self;
}
-(void)createSubViews
{
    self.titleLabel = [[UILabel alloc]initWithFrame:CGRectMake(5*WIDTHSCALE, 5*HEIGHTSCALE, 280*WIDTHSCALE, 20*HEIGHTSCALE)];
    [self.contentView addSubview:self.titleLabel];
    
    self.imgsrc = [[UIImageView alloc]initWithFrame:CGRectMake(5*WIDTHSCALE, 25*HEIGHTSCALE, 120*WIDTHSCALE, 70*HEIGHTSCALE)];
    [self.contentView addSubview:self.imgsrc];
    
    self.imgsrc1 = [[UIImageView alloc]initWithFrame:CGRectMake(130*WIDTHSCALE, 25*HEIGHTSCALE, 120*WIDTHSCALE, 70*HEIGHTSCALE)];
    [self.contentView addSubview:self.imgsrc1];
    
    self.imgsrc2 = [[UIImageView alloc]initWithFrame:CGRectMake(255*WIDTHSCALE, 25*HEIGHTSCALE, 115*WIDTHSCALE, 70*HEIGHTSCALE)];
    [self.contentView addSubview:self.imgsrc2];
    
    self.replyCountLabel = [[UILabel alloc]initWithFrame:CGRectMake(285*WIDTHSCALE, 5*HEIGHTSCALE, 80*WIDTHSCALE, 15*HEIGHTSCALE)];
    [self.contentView addSubview:self.replyCountLabel];
    [self.replyCountLabel setFont:[UIFont systemFontOfSize:13]];
    self.replyCountLabel.textColor = [UIColor grayColor];
    
}



-(void)setModel:(YijiaModel *)model
{
    _model = model;
    
    NSString *str1 = [_model.imgextra objectAtIndex:0];
    NSString *str2 = [_model.imgextra objectAtIndex:1];
    self.titleLabel.text = _model.title;
    self.replyCountLabel.text = [NSString stringWithFormat:@"%ld跟帖",_model.replyCount];
    [self.imgsrc sd_setImageWithURL:[NSURL URLWithString:_model.imgsrc]];
    [self.imgsrc1 sd_setImageWithURL:[NSURL URLWithString:str1]];
    [self.imgsrc2 sd_setImageWithURL:[NSURL URLWithString:str2]];
}



@end
